home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / graphics / qrt.lzh / OFFSET.C < prev    next >
C/C++ Source or Header  |  1989-02-16  |  2KB  |  71 lines

  1. /**********************************************************
  2.  
  3.       Routines to offset primitives by dx, dy, dz
  4.       (used for user defined primitive types)
  5.  
  6.  **********************************************************/
  7.  
  8. #include "qrt.h"
  9.  
  10. /* #define OFFSETDEBUG TRUE */
  11.  
  12. /**********************************************************
  13.  
  14.     This will offset most types of objects that use
  15.     the 'loc' vector for their location.
  16.  
  17.  **********************************************************/
  18.  
  19. Standard_Offset(obj,offset)
  20.   OBJ_PTR obj;
  21.   VECT_PTR offset;
  22. {
  23.  
  24. # ifdef ROBUST
  25.     if (!((obj->type == SPHERE)        ||
  26.           (obj->type == PARALLELOGRAM) ||
  27.           (obj->type == RING)          ||
  28.           (obj->type == TRIANGLE)      ||
  29.           (obj->type == QUADRATIC)))
  30.       Error(INTERNAL_ERROR,1301);
  31. # endif
  32.  
  33.   /** now add the offset (this is a tough one) **/
  34.  
  35. # ifdef OFFSETDEBUG
  36.     printf("STANDARDOFFSET: %f %f %f\n",
  37.            offset->x,
  38.            offset->y,
  39.            offset->z);
  40. # endif
  41.  
  42.   VectorAdd(&(obj->loc),&(obj->loc),offset);
  43. }
  44.  
  45.  
  46. /**********************************************************
  47.  
  48.   This will offset BBOX type objects.  It actually
  49.   does nothing, since bbox values are filled after
  50.   the tree is built.
  51.  
  52.  **********************************************************/
  53.  
  54. Offset_Bbox(obj,offset)
  55.   OBJ_PTR obj;
  56.   VECT_PTR offset;
  57. {
  58.  
  59. # ifdef ROBUST
  60.     if (obj->type != BBOX) Error(INTERNAL_ERROR,1302);
  61. # endif
  62.  
  63. # ifdef OFFSETDEBUG
  64.     printf("OFFSETBBOX: %f %f %f\n",
  65.            offset->x,
  66.            offset->y,
  67.            offset->z);
  68. # endif
  69. }
  70.  
  71.